import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/3 13:42
 * @description 统计 0的个数，1的个数，01的个数，10的个数
 */
public class Solution {
    public static void main(String[] args) {

    }
    public long numberOfWays(String s) {
        long n0 = 0, n1 = 0, n01 = 0, n10 = 0;
        long ans = 0;
        for (char c : s.toCharArray()) {
            if (c == '0') {
                n0++;
                n10 += n1;
                ans += n01;
            }else {
                n1++;
                n01 += n0;
                ans += n10;
            }
        }
        return ans;
    }
}
